<?
session_start();
include_once("secure/connect.php");
include_once("secure/functions.php");
if (!$_SESSION['logged'])
	{
	print "SESSION FERMEE";
	die;
	}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
// (C) 2001 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

var howLong = <? if ($_GET['OK']) { print "700"; } else {print "4000";}?>;

t = null;
function closeMe(){
t = setTimeout("self.close()",howLong);
}

</script>
<title>Destruction fiche loc</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../site_print.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body,td,th {
	color: #FFFFFF;
	font-size: medium;
	font-weight: bold;
}
body {
	background-color: #FF0000;
}
a:link {
	color: #FFFFFF;
}
a:visited {
	color: #FFFFFF;
}
a:hover {
	color: #FFFFFF;
}
a:active {
	color: #FFFFFF;
}
a {
	font-size: large;
	font-weight: bold;
}
-->
</style></head>

<body  onload="closeMe();self.focus()">
<br>
<div align="center">
<?
$sql_look_fiche_loc="SELECT id, etat FROM fiches_loc WHERE id='".$_GET['id']."'";
$res_look_fiche_loc=mysql_query($sql_look_fiche_loc,$db);
$ligne_look_fiche_loc=mysql_fetch_array ($res_look_fiche_loc);
if($ligne_look_fiche_loc['etat']=='1' && $_GET['OK'])
	{
	$sql_del_fiche_loc="DELETE FROM fiches_loc WHERE id='".$_GET['id']."'";
	mysql_query($sql_del_fiche_loc,$db);
	$sql_del_fiche_loc_items="DELETE FROM fiches_loc_items WHERE id_fiche_loc='".$_GET['id']."'";
	mysql_query($sql_del_fiche_loc_items,$db);
	print "Fiche effacée";
	echo "<script language='Javascript'>
           opener.location.reload();
     </script>";
	}
elseif ($ligne_look_fiche_loc['id']==$_GET['id'])
	{
	print "effacer fiche n°".$ligne_look_fiche_loc['id']." ? <a href=?id=".$_GET['id']."&OK=1>OK</a>";
	}

?></div>
</body>
</html>
